import requests from "@/api/request.js";

export const getJoinedGroup = (userId)=>
    requests({
        url: `/getJoinedGroup/${userId}`,
        method: 'GET'
    })

export const getGroupInfo = (groupId)=>
    requests({
        url: `/getGroupInfo/${groupId}`,
        method: 'GET'
    })

export const createGroup = (formData) =>
    requests({
        url: '/createGroup',
        method: 'POST',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data',
        }
    })

export const updateGroup = (formData) =>
    requests({
        url: "/updateGroup",
        method: "POST",
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data',
        }
    })

export const getGroupMember = (groupId) =>
    requests({
        url: `/getGroupMember/${groupId}`,
        method: 'GET'
    })

export const getChannel = (groupId) =>
    requests({
        url: `/getChannel/${groupId}`,
        method: 'GET'
    })

export const createChannel = (data) =>
    requests({
        url: '/createChannel',
        method: "POST",
        data
    })

export const getChannelTag = (groupId) =>
    requests({
        url: "/getChannelTag",
        method: "GET",
        params :{groupId}
    })

export const createChannelTag = (data) =>
    requests({
        url: "/createChannelTag",
        method: "POST",
        data
    })
